package com.richapp.launcher.ui.adapter;

import com.richapp.launcher.ui.fragments.home.app.SmartAppFragment;
import com.richapp.launcher.ui.fragments.home.control.SmartControlFragment;
import com.richapp.launcher.ui.fragments.home.demand.SmartDemandFragment;
import com.richapp.launcher.ui.fragments.home.setting.SettingFragment;
import com.richapp.launcher.ui.fragments.market.SmartAppMarketFragment;
import com.richapp.launcher.ui.view.IconPagerAdapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


public class MainFragmentAdapter extends FragmentPagerAdapter implements IconPagerAdapter{
	public static final int LENGTH = 5;
	public MainFragmentAdapter(FragmentManager fm) {
		super(fm);
	}
	
	@Override
	public Fragment getItem(int position) {
		int index = position % LENGTH;
		if (index == 0) {
			return SmartControlFragment.getInstance();
		}else if (index == 1) {
			return SmartDemandFragment.getInstance();
		}else if (index == 2) {
			return SmartAppFragment.getInstance();
		}else if (index == 3) {
			return SmartAppMarketFragment.getInstance();
		}else if (index == 4) {
			return SettingFragment.getInstance();
		}else {
			return SmartControlFragment.getInstance();
		}
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return LENGTH;
	}

	@Override
	public int getIconResId(int index) {
		// TODO Auto-generated method stub
		return 0;
	}	
}
